# -*- coding: utf-8 -*-
import requests
import logging
import re
from urllib.parse import urljoin

logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s: %(message)s')

BASE_URL = 'https://ssr1.scrape.center/'
TOTAL_PAGE = 10


def scrape_page(url):
    logging.info('scraping %s...', url)
    try:
        response = requests.get(url)
        if response.status_code == 200:
            return response.text
        logging.error('get invalid status code %s while scraping %s', response.status_code, url)
    except requests.RequestException:
        logging.error('Error occurred while scraping %s', url, exc_info=True)


if __name__ == '__main__':
    res = scrape_page(BASE_URL)
    print(res)